<html>
<head><meta charset="utf-8"><title>Trying to get rustdoc to generate redirects · rustdoc · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/index.html">rustdoc</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Trying.20to.20get.20rustdoc.20to.20generate.20redirects.html">Trying to get rustdoc to generate redirects</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="220414702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Trying%20to%20get%20rustdoc%20to%20generate%20redirects/near/220414702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Trying.20to.20get.20rustdoc.20to.20generate.20redirects.html#220414702">(Dec 18 2020 at 19:02)</a>:</h4>
<p><span class="user-mention" data-user-id="334260">@Dániel Buga</span> I'm trying to reproduce the issue you saw on <a href="https://github.com/deadlinks/cargo-deadlinks/issues/120">https://github.com/deadlinks/cargo-deadlinks/issues/120</a> with something smaller than all of <code>embedded-text</code>. Do you know what causes that redirect page to be generated? I tried</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">mod</span> <span class="nn">inner</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">pub</span><span class="w"> </span><span class="k">struct</span> <span class="nc">S</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">pub</span><span class="w"> </span><span class="k">use</span><span class="w"> </span><span class="n">inner</span>::<span class="n">S</span><span class="p">;</span><span class="w"></span>

<span class="k">pub</span><span class="w"> </span><span class="k">mod</span> <span class="nn">prelude</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="c1">// This generates a redirect link.</span>
<span class="w">    </span><span class="k">pub</span><span class="w"> </span><span class="k">use</span><span class="w"> </span><span class="k">crate</span>::<span class="n">S</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>but that caused <code>S</code> to be inlined in both <code>prelude</code> and the crate root.</p>



<a name="220414731"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Trying%20to%20get%20rustdoc%20to%20generate%20redirects/near/220414731" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Trying.20to.20get.20rustdoc.20to.20generate.20redirects.html#220414731">(Dec 18 2020 at 19:02)</a>:</h4>
<p>(I have a fix btw, just trying to write the test)</p>



<a name="220415259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Trying%20to%20get%20rustdoc%20to%20generate%20redirects/near/220415259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Trying.20to.20get.20rustdoc.20to.20generate.20redirects.html#220415259">(Dec 18 2020 at 19:06)</a>:</h4>
<p>I hope this isn't related to cross-crate links :/</p>



<a name="220415474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Trying%20to%20get%20rustdoc%20to%20generate%20redirects/near/220415474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Trying.20to.20get.20rustdoc.20to.20generate.20redirects.html#220415474">(Dec 18 2020 at 19:08)</a>:</h4>
<p>I found <a href="https://github.com/rust-lang/rust/blob/6340607acaab10eed3cf11ef7ad3564db58ec981/src/librustdoc/html/render/mod.rs#L1597">https://github.com/rust-lang/rust/blob/6340607acaab10eed3cf11ef7ad3564db58ec981/src/librustdoc/html/render/mod.rs#L1597</a> and <a href="https://github.com/rust-lang/rust/blob/6340607acaab10eed3cf11ef7ad3564db58ec981/src/librustdoc/html/render/mod.rs#L683">https://github.com/rust-lang/rust/blob/6340607acaab10eed3cf11ef7ad3564db58ec981/src/librustdoc/html/render/mod.rs#L683</a>, I think I'll just go with the macro one since it's easier to replicate</p>



<a name="220415532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Trying%20to%20get%20rustdoc%20to%20generate%20redirects/near/220415532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Trying.20to.20get.20rustdoc.20to.20generate.20redirects.html#220415532">(Dec 18 2020 at 19:08)</a>:</h4>
<p>ah hmm but macros don't have associated items, gah</p>



<a name="220415606"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Trying%20to%20get%20rustdoc%20to%20generate%20redirects/near/220415606" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Trying.20to.20get.20rustdoc.20to.20generate.20redirects.html#220415606">(Dec 18 2020 at 19:09)</a>:</h4>
<p>I don't know, but I can check in a bit.</p>



<a name="220415758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Trying%20to%20get%20rustdoc%20to%20generate%20redirects/near/220415758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Trying.20to.20get.20rustdoc.20to.20generate.20redirects.html#220415758">(Dec 18 2020 at 19:10)</a>:</h4>
<blockquote>
<p>618:            self.render_redirect_pages = item.is_stripped();</p>
</blockquote>
<p>oh boy</p>



<a name="220416019"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Trying%20to%20get%20rustdoc%20to%20generate%20redirects/near/220416019" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Trying.20to.20get.20rustdoc.20to.20generate.20redirects.html#220416019">(Dec 18 2020 at 19:12)</a>:</h4>
<p>aha, got it - this happens when the <em>module</em> is private but contains a public item that's linked to from elsewhere</p>



<a name="220416056"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Trying%20to%20get%20rustdoc%20to%20generate%20redirects/near/220416056" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Trying.20to.20get.20rustdoc.20to.20generate.20redirects.html#220416056">(Dec 18 2020 at 19:13)</a>:</h4>
<p>so to replicate I need to link to <code>inner/struct.S.html</code>, which redirects to the place it was inlined:</p>
<div class="codehilite" data-code-language="HTML"><pre><span></span><code>7:    <span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>Redirecting to <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"../../simple_project/struct.S.html"</span><span class="p">&gt;</span>../../simple_project/struct.S.html<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>...<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
</code></pre></div>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>